package com.raos.example.listener;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 消息消费者
 *
 * @author raos
 * @date 2025-02-28
 */
@Component
@RocketMQMessageListener(
        topic = "delayTopic",          // 监听的主题
        consumerGroup = "order-group", // 消费者组
        selectorExpression = "*"       // Tag 过滤（* 表示所有）
)
public class OrderConsumer implements RocketMQListener<String> {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void onMessage(String message) {
        logger.info("收到订单消息: {}", message);
        // 处理业务逻辑（如订单状态更新、超时处理等）
    }

}
